#include <wx/wx.h>

class MyFrame : public wxFrame
{
public:
   MyFrame(const wxString& title);

private:
    wxMenuBar *menubar;
    wxMenu *file;
    wxMenu *edit;
    wxMenu *help;
    wxTextCtrl *textctrl;

    wxButton *btnOk;
    wxButton *btnCancel;
};

MyFrame::MyFrame(const wxString& title)
   : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300))
{
   menubar = new wxMenuBar();
   file = new wxMenu();
   edit = new wxMenu();
   help = new wxMenu();

   btnOk = new wxButton(this, wxID_ANY, "OK");
   btnCancel = new wxButton(this, wxID_ANY, "Cancel");

   file->Append(wxID_EXIT, "E&xit");
   edit->Append(wxID_CUT, "Cut");

   menubar->Append(file, "&File");
   menubar->Append(edit, "&Edit");
   menubar->Append(help, "&Help");

   SetMenuBar(menubar);

   textctrl = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);

   textctrl->SetSize(wxSize(100, 100));
   textctrl->SetMinSize(wxSize(100, 100));
   textctrl->SetMaxSize(wxSize(100, 100));
   textctrl->SetSizeHints(wxSize(100, 100));

   wxSizer *hsizer = new wxBoxSizer(wxHORIZONTAL);
   hsizer->AddStretchSpacer();
   hsizer->Add(btnOk, 0, wxALL, 5);
   hsizer->Add(btnCancel, 0, wxALL, 5);

   wxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
   vsizer->Add(textctrl, 1, wxEXPAND | wxALL, 5);
   vsizer->Add(hsizer, 0, wxEXPAND | wxALL, 5);

   SetSizer(vsizer);

   btnOk->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event) {
      textctrl->AppendText(wxT("Ok button clicked!\n"));
   });

   btnCancel->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event) {
      textctrl->AppendText(wxT("Cancel button clicked!\n"));
   });

   Center();
//    Centre();
}

class MyApp : public wxApp
{
public:
   virtual bool OnInit();
};

bool MyApp::OnInit()
{
   MyFrame *frame = new MyFrame("Sizer");
   frame->Show(true);
   return true;
}

wxIMPLEMENT_APP(MyApp);

